/*
 Xern Entity Relocation Network
 Copyright (C) 2011 Ronie Salgado <roniesalg@gmail.com>

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
*/

#ifndef XERN_MATERIAL_HPP
#define XERN_MATERIAL_HPP

#include <OgreRoot.h>
#include "Xern/IMaterial.hpp"

namespace XernOgre
{
	using namespace Xern;

	class Material: public IMaterial
	{
	public:
		Material(Ogre::MaterialPtr material);
		~Material();

		virtual ResourceFlags GetFlags() const;
		virtual void UpdateState(boost::shared_ptr<IDataFilter> stateData);

		virtual const uuid &GetId() const;
		virtual void SetId(const uuid &id);

		const std::string &GetName() const;

		virtual bool SetTexture(const std::string &name, boost::shared_ptr<ITexture> texture);
		virtual bool SetTexture(const std::string &name, const std::string &textureName);

		virtual const Color &GetAmbient() const;
		virtual void SetAmbient(const Color &c);

		virtual const Color &GetDiffuse() const;
		virtual void SetDiffuse(const Color &c);

		virtual const Color &GetSpecular() const;
		virtual void SetSpecular(const Color &c);

		virtual const Color &GetEmissive() const;
		virtual void SetEmissive(const Color &c);

		virtual bool Prepare();

	private:
		friend class Geometry;
		friend class GeometryInstance;
		uuid id;
		Ogre::MaterialPtr material;
		Ogre::AliasTextureNamePairList aliases;
		Color ambient;
		Color diffuse;
		Color specular;
		Color emissive;
	};
}

#endif //XERN_MATERIAL_HPP
